+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
"Stable support for democracy in East and Southeast Asia?"
replication code 
2021-12-01
Marlene Mauk
marlene.mauk@gesis.org
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

****************************
   accessing the data
****************************

* The paper relies on data from the Asian Barometer Survey. All data can be obtained through the application form on their website (asianbarometer.org).
* The code below uses the merged datasets for each wave, in the versions indicated by the filenames.

cd [path] 

****************************
  recoding the survey data
****************************
//**ABS 1**//
import spss "[path]\ABS Wave I\merge\merge v4.2.sav"

gen wave = 1
gen year = yrsurvey
keep if country==1 | country==3 | country==5 | country==7 | country==9
tab country
gen countrymerge = country + 400
replace countrymerge = 403 if country==7 /*Taiwan*/
replace countrymerge = 404 if country==3 /*South Korea*/
replace countrymerge = 408 if country==5 /*Mongolia*/
lab define country 401 "Japan" 403 "Taiwan" 404 "South Korea" 408 "Mongolia" 409 "Indonesia" 
lab val countrymerge country
drop country
rename countrymerge country

tab1 q008 q010 q007 q011 q013 q012
mvdecode q008 q010 q007 q011 q013 q012, mv(-1 7 8 9)
gen trust1 = ((q008-1)/3)
gen trust2 = ((q010-1)/3)
gen trust5 = ((q007-1)/3)
gen trust7 = ((q011-1)/3)
gen trust3 = ((q013-1)/3)
gen trust4 = ((q012-1)/3)

rename w_all allweight

keep trust* wave year country allweight
save eab1.dta, replace

//**ABS 2**//
import spss "[path]\ABS Wave II\merge\absii_merge13_v20100810.sav"

gen wave = 2
gen year = ir007_3
keep if country==1 | country==3 | country==5 | country==7 | country==9
tab country
gen countrymerge = country + 400
replace countrymerge = 403 if country==7 /*Taiwan*/
replace countrymerge = 404 if country==3 /*South Korea*/
replace countrymerge = 408 if country==5 /*Mongolia*/
lab define country 401 "Japan" 403 "Taiwan" 404 "South Korea" 408 "Mongolia" 409 "Indonesia" 
lab val countrymerge country
tab countrymerge

tab1 q008 q010 q007 q011 q013 q012
mvdecode q008 q010 q007 q011 q013 q012, mv(-1 7 8 9)
gen trust1 = ((q008-1)/3)
gen trust2 = ((q010-1)/3)
gen trust5 = ((q007-1)/3)
gen trust7 = ((q011-1)/3)
gen trust3 = ((q013-1)/3)
gen trust4 = ((q012-1)/3)
drop country
rename countrymerge country
tab country if year==.
replace year=2006 if country==404

egen allweight = rowmean(w_JP w_KR w_MN w_TW4) /*there is no weighting variable for Indonesia*/

keep trust* wave year country allweight
save eab2.dta, replace

//**ABS 3**//
use "[path]\ABS Wave III\merge\ABS3_merge20130904_release.dta"
gen wave = 3
gen year = year(ir9)
numlabel _all, add
tab country
keep if country==1 | country==3 | country==5 | country==7 | country==9
tab country
gen countrymerge = country + 400
replace countrymerge = 403 if country==7 /*Taiwan*/
replace countrymerge = 404 if country==3 /*South Korea*/
replace countrymerge = 408 if country==5 /*Mongolia*/
lab drop country
lab define country 401 "Japan" 403 "Taiwan" 404 "South Korea" 408 "Mongolia" 409 "Indonesia" 
lab val countrymerge country
drop country
rename countrymerge country

tab1 q9 q11 q14 q13 q8 q12
mvdecode q9 q11 q14 q13 q8 q12, mv(-1 7 8 9)
gen trust1 = 1-((q9-1)/3)
gen trust2 = 1-((q11-1)/3)
gen trust5 = 1-((q8-1)/3)
gen trust7 = 1-((q12-1)/3)
gen trust3 = 1-((q14-1)/3)
gen trust4 = 1-((q13-1)/3)

tab1 q75 q74 q76 q78
mvdecode q75 q74 q76 q78, mv(7/9)
gen val1 = .
replace val1 = 0 if (q75==2 & q75a==1)
replace val1 = 0.33 if (q75==2 & q75a==2)
replace val1 = 0.66 if (q75==1 & q75a==2)
replace val1 = 1 if (q75==1 & q75a==1)
gen val2 = .
replace val2 = 0 if (q74==2 & q74a==1)
replace val2 = 0.33 if (q74==2 & q74a==2)
replace val2 = 0.66 if (q74==1 & q74a==2)
replace val2 = 1 if (q74==1 & q74a==1)
gen val3 = .
replace val3 = 0 if (q76==2 & q76a==1)
replace val3 = 0.33 if (q76==2 & q76a==2)
replace val3 = 0.66 if (q76==1 & q76a==2)
replace val3 = 1 if (q76==1 & q76a==1)
gen val4 = .
replace val4 = 0 if (q78==2 & q78a==1)
replace val4 = 0.33 if (q78==2 & q78a==2)
replace val4 = 0.66 if (q78==1 & q78a==2)
replace val4 = 1 if (q78==1 & q78a==1)

mvdecode q129-q131, mv(7/9)
rename q129 strongman
rename q130 oneparty
rename q131 military
mvdecode q23 q1 q95, mv(7/9)
gen soctrust = 1-(q23-1)
gen spe2 = 1-((q1-1)/4)
gen as1 = 1-((q95-1)/3)
tab as1 q95

mvdecode q43 q4, mv(7/9)
gen polint = 1-((q43-1)/3)
gen status3 = 1-((q4-1)/4)
gen female = se2-1
gen age = se3a
gen edulevel = .
replace edulevel = 0 if se5==1
replace edulevel = 1 if se5==2 | se5==3
replace edulevel = 2 if se5==4 | se5==5 | se5==6 | se5==7
replace edulevel = 3 if se5==8 | se5==9 | se5==10

keep trust* wave year country val* spe2 soctrust as1 polint female age edulevel status3 strongman oneparty military allweight
save eab3.dta, replace

//**ABS 4**//
use "[path]\ABS Wave IV\W4 Merged Data\W4_v15_merged20181211_release.dta"
describe
numlabel _all, add
tab country
keep if country==1 | country==3 | country==5 | country==7 | country==9
gen countrymerge = country + 400
replace countrymerge = 403 if country==7 /*taiwan*/
replace countrymerge = 404 if country==3 /*south korea*/
replace countrymerge = 408 if country==5 /*mongolia*/
lab define country 401 "Japan" 403 "Taiwan" 404 "South Korea" 408 "Mongolia" 409 "Indonesia" 
lab val countrymerge country
tab countrymerge
gen wave = 4
drop country
rename countrymerge country
lab val country country
tab country

tab1 q9 q11 q14 q13 q8 q12
mvdecode q9 q11 q14 q13 q8 q12, mv(-1 7 8 9)
gen trust1 = 1-((q9-1)/3)
gen trust2 = 1-((q11-1)/3)
gen trust5 = 1-((q8-1)/3)
gen trust7 = 1-((q12-1)/3)
gen trust3 = 1-((q14-1)/3)
gen trust4 = 1-((q13-1)/3)

mvdecode q1, mv(-1 7 8 9)
gen spe2 = 1-((q1-1)/4)

mvdecode q79 q80 q81 q82 q125 q130 q131 q132 q133, mv (-1 7 8 9)
gen val1 = .
replace val1 = 0 if (q80==2 & q80a==1)
replace val1 = 0.33 if (q80==2 & q80a==2)
replace val1 = 0.66 if (q80==1 & q80a==2)
replace val1 = 1 if (q80==1 & q80a==1)
gen val2 = .
replace val2 = 0 if (q81==2 & q81a==1)
replace val2 = 0.33 if (q81==2 & q81a==2)
replace val2 = 0.66 if (q81==1 & q81a==2)
replace val2 = 1 if (q81==1 & q81a==1)
gen val3 = .
replace val3 = 0 if (q79==2 & q79a==1)
replace val3 = 0.33 if (q79==2 & q79a==2)
replace val3 = 0.66 if (q79==1 & q79a==2)
replace val3 = 1 if (q79==1 & q79a==1)
gen val4 = .
replace val4 = 0 if (q82==2 & q82a==1)
replace val4 = 0.33 if (q82==2 & q82a==2)
replace val4 = 0.66 if (q82==1 & q82a==2)
replace val4 = 1 if (q82==1 & q82a==1)

rename q130 strongman
rename q131 oneparty
rename q132 military

mvdecode se3_2 se2, mv(-1)
gen age = se3_2
gen female = se2-1

mvdecode q4 q44, mv(-1 7 8 9)
gen status3 = 1-((q4-1)/4)
gen polint = 1-((q44-1)/3)

mvdecode se5, mv(-1 98 99)
gen edulevel = .
replace edulevel = 0 if se5==1
replace edulevel = 1 if se5==2 | se5==3 
replace edulevel = 2 if se5==4 | se5==5 | se5==6 | se5==7
replace edulevel = 3 if se5==8 | se5==9 | se5==10

mvdecode q94, mv(-1 97 98 99)
gen dpe2 = (q94-1)/9

mvdecode q98, mv(-1 8 9)
gen as1 = 1-((q98-1)/3)
tab as1 q98

mvdecode q24, mv(-1 7 8 9)
gen soctrust = 1-((q24-1)/3)
tab soctrust q24

rename w_cross allweight

keep trust* wave year country val* spe2 soctrust as1 polint female age edulevel status3 strongman oneparty military allweight
save eab4.dta, replace

use eab4.dta
lab var trust1 "trust in government"
lab var trust2 "trust in parliament"
lab var trust3 "trust in police"
lab var trust4 "trust in military"
lab var trust5 "trust in courts"
lab var trust7 "trust in civil service"
lab var spe2 "country's present economic situation"
lab var status3 "own economic condition"
lab var val1 "gov is employee"
lab var val2 "media should be free"
lab var val3 "gov implements what voters want"
lab var val4 "choose leaders through elections"
lab var as1 "satisfaction with incumbent government"
lab var soctrust "social trust"
numlabel _all, add

save eab4.dta, replace


***************************
  recoding the macro data
***************************
use [path]\V-Dem\Country_Year_V-Dem_Full+others_STATA_v11.1\V-Dem-CY-Full+Others-v11.1.dta
drop if year<=1996
rename COWcode cow
keep country_name year cow v2x_corr v2x_libdem v2x_regime 
save vdem_v11.dta, replace

gen countryid = .
replace countryid=401 if country_name=="Japan"
replace countryid=403 if country_name=="Taiwan"
replace countryid=404 if country_name=="South Korea"
replace countryid=408 if country_name=="Mongolia"
replace countryid=409 if country_name=="Indonesia"

drop if countryid==.
rename countryid country
save vdem_v11.dta, replace


***********************************
  merging the survey + macro data
***********************************
use .\eab4.dta
append using .\eab1.dta
append using .\eab2.dta
append using .\eab3.dta
save backsliding.dta, replace

use backsliding.dta
merge m:1 country year using vdem_v11.dta
tab country year if _merge==2 /*these are countries and years in which no eab was fielded*/
drop if _merge==2
save backsliding.dta, replace


**********************
  measurement models
**********************
use backsliding.dta
factor trust3 trust5 trust7
sem (trust_ -> trust5) (trust_ -> trust3) (trust_ -> trust7), method(adf) iterate(50) latent(trust_ ) nocapslatent
sem, standardized
estat gof, stats(all)
estat mindices
predict trust, latent(trust_)
sum trust
gen trust01 = ((trust-r(min))/(r(max)-r(min)))
sum trust01
drop trust
rename trust01 trust

factor val1 val2 val3 val4
sem (val_ -> val1 val2 val3 val4, ), method(adf) iterate(50) latent(val_) nocapslatent
sem, standardized
estat gof, stats(all)
estat mindices
predict val, latent(val_)
sum val
gen val01 = ((val-r(min))/(r(max)-r(min)))
sum val01
drop val
rename val01 val
save backsliding.dta, replace


*****************************************
  constructing mean trust variable 
*****************************************
use backsliding.dta
gen cround = (country*10)+wave

ssc install _gwtmean

sort country wave
egen mtrust1 = wtmean(trust1), weight(allweight) by(country wave)
egen mtrust2 = wtmean(trust2), weight(allweight) by(country wave)
egen mtrust3 = wtmean(trust3), weight(allweight) by(country wave)
egen mtrust5 = wtmean(trust5), weight(allweight) by(country wave)
egen mtrust7 = wtmean(trust7), weight(allweight) by(country wave)
egen mtrust = wtmean(trust), weight(allweight) by(country wave)
sum mtrust3 mtrust5 mtrust7 mtrust
lab var trust1 "trust in government"
lab var trust2 "trust in parliament"
lab var trust3 "trust in police"
lab var trust4 "trust in military"
lab var trust5 "trust in courts"
lab var trust7 "trust in civil service"
save backsliding.dta, replace


******************************************
  empirical analyses - levels of trust
******************************************
use backsliding.dta

graph bar mtrust1, over(country, relabel(1 "JP" 2 "TW" 3 "KO" 4 "MO" 5 "ID")) ytitle("") intensity(5) scheme(tufte) name(graph1, replace) title(trust in government), if wave==4
graph export trust1_bycountry.png, replace
graph bar mtrust2, over(country, relabel(1 "JP" 2 "TW" 3 "KO" 4 "MO" 5 "ID")) ytitle("") intensity(25) scheme(tufte) name(graph2, replace) title(trust in parliament) ylabel(0(0.2)0.6), if wave==4
graph export trust2_bycountry.png, replace
graph bar mtrust3, over(country, relabel(1 "JP" 2 "TW" 3 "KO" 4 "MO" 5 "ID")) ytitle("") intensity(50) scheme(tufte) name(graph3, replace) title(trust in police), if wave==4
graph export trust3_bycountry.png, replace
graph bar mtrust5, over(country, relabel(1 "JP" 2 "TW" 3 "KO" 4 "MO" 5 "ID")) ytitle("") intensity(75) scheme(tufte) name(graph4, replace) title(trust in courts), if wave==4
graph export trust5_bycountry.png, replace
graph bar mtrust7, over(country, relabel(1 "JP" 2 "TW" 3 "KO" 4 "MO" 5 "ID")) ytitle("") intensity(100) scheme(tufte) name(graph5, replace) title(trust in civil service), if wave==4
graph export trust7_bycountry.png, replace
graph combine graph1 graph2 graph3 graph4 graph5, cols(2) scheme(tufte)
graph export figure1.png, replace

numlabel _all, remove
twoway connected mtrust1 mtrust2 mtrust3 mtrust5 mtrust7 year, sort by(country, note("") ixaxes) scheme(tufte) msymbol(X D O T S) msize(medium small medsmall medsmall small) mcolor(gs0 gs4 gs8) lcolor(gs0 gs2 gs4 gs6 gs8) xtitle("") ///
legend(rows(2) label(1 "trust in government") label(2 "trust in parliament")  label(3 "trust in police") label(4 "trust in courts") label(5 "trust in civil service")) /*using mtrust ensures that data is weighted*/
graph export figure2.png, replace



******************************************
   empirical analyses - sources of trust
******************************************
use backsliding.dta
ssc install scheme_tufte
ssc install coefplot

regress trust val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==401
estimates store japan
regress trust val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==403
estimates store taiwan
regress trust val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==404
estimates store korea
regress trust val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==408
estimates store mongolia
regress trust val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==409
estimates store indonesia

set scheme tufte
coefplot japan, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Japan) ///
|| taiwan, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Taiwan) ///
|| korea, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(South Korea) ///
|| mongolia, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Mongolia) ///
|| indonesia, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Indonesia) ///
coeflabels(val="liberal democratic values" soctrust="social trust" spe2="economic performance evaluations" as1="incumbent support") ///
ylabel ( , labsize(small)) msymbol(S) nokey 
graph export figure3.png, replace


* r² for regressions with only long-term factors
regress trust val soctrust polint status3 i.edulevel female age if wave==4 & country==401, beta
estimates store jplong
regress trust val soctrust polint status3 i.edulevel female age if wave==4 & country==403, beta
estimates store twlong
regress trust val soctrust polint status3 i.edulevel female age if wave==4 & country==404, beta
estimates store kolong
regress trust val soctrust polint status3 i.edulevel female age if wave==4 & country==408, beta
estimates store molong
regress trust val soctrust polint status3 i.edulevel female age if wave==4 & country==409, beta
estimates store idlong

* r² for regressions with only short-term factors
regress trust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==401, beta
estimates store jpshort
regress trust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==403, beta
estimates store twshort
regress trust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==404, beta
estimates store koshort
regress trust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==408, beta
estimates store moshort
regress trust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==409, beta
estimates store idshort

estimates table jplong twlong kolong molong idlong, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save table_long, replace
estimates table jpshort twshort koshort moshort idshort, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save table_short, replace



********************************************
   empirical analyses - robustness checks
********************************************
use backsliding.dta
estimates clear

* similar results for wave 3 data? *
regress trust val soctrust spe2 as1 polint status3 i.edulevel female age if wave==3 & country==401
estimates store japan
regress trust val soctrust spe2 as1 polint status3 i.edulevel female age if wave==3 & country==403
estimates store taiwan
regress trust val soctrust spe2 as1 polint status3 i.edulevel female age if wave==3 & country==404
estimates store korea
regress trust val soctrust spe2 as1 polint status3 i.edulevel female age if wave==3 & country==408
estimates store mongolia
regress trust val soctrust spe2 as1 polint status3 i.edulevel female age if wave==3 & country==409
estimates store indonesia

set scheme tufte
coefplot japan, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Japan) ///
|| taiwan, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Taiwan) ///
|| korea, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(South Korea) ///
|| mongolia, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Mongolia) ///
|| indonesia, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Indonesia) ///
coeflabels(val="liberal democratic values" soctrust="social trust" spe2="economic performance evaluations" as1="incumbent support") ///
ylabel ( , labsize(small)) msymbol(S) nokey 
graph export figure3_wave3.png, replace

* r² for regressions with only long-term factors
estimates clear
regress trust val soctrust polint status3 i.edulevel female age if wave==3
estimates store alllong
regress trust val soctrust polint status3 i.edulevel female age if wave==3 & country==401
estimates store jplong
regress trust val soctrust polint status3 i.edulevel female age if wave==3 & country==403
estimates store twlong
regress trust val soctrust polint status3 i.edulevel female age if wave==3 & country==404
estimates store kolong
regress trust val soctrust polint status3 i.edulevel female age if wave==3 & country==408
estimates store molong
regress trust val soctrust polint status3 i.edulevel female age if wave==3 & country==409
estimates store idlong

* r² for regressions with only short-term factors
regress trust spe2 as1 polint status3 i.edulevel female age if wave==3
estimates store allshort
regress trust spe2 as1 polint status3 i.edulevel female age if wave==3 & country==401
estimates store jpshort
regress trust spe2 as1 polint status3 i.edulevel female age if wave==3 & country==403
estimates store twshort
regress trust spe2 as1 polint status3 i.edulevel female age if wave==3 & country==404
estimates store koshort
regress trust spe2 as1 polint status3 i.edulevel female age if wave==3 & country==408
estimates store moshort
regress trust spe2 as1 polint status3 i.edulevel female age if wave==3 & country==409
estimates store idshort

estimates table alllong jplong twlong kolong molong idlong, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save table_long_wave3, replace
estimates table allshort jpshort twshort koshort moshort idshort, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save table_short_wave3, replace


* institutional trust merely an accurate reflection of democratic quality? *
estimates clear
mixed trust val soctrust spe2 as1 polint status3 i.edulevel female age v2x_libdem || country: , vce(robust), if wave==4
estimates store all2

set scheme tufte
coefplot all2, keep(val soctrust spe2 as1 v2x_libdem) xline(0, lcolor(black)) levels(95) ///
coeflabels(val="liberal democratic values" soctrust="social trust" spe2="economic performance evaluations" as1="incumbent support" v2x_libdem="democratic performance") ///
ylabel ( , labsize(small)) msymbol(S) mfcolor(none) msize(small) nokey
graph export oa_fig1.png, replace


* including democratic performance evaluations as a control variable
regress trust val soctrust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4 & country==401
estimates store japan
regress trust val soctrust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4 & country==403
estimates store taiwan
regress trust val soctrust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4 & country==404
estimates store korea
regress trust val soctrust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4 & country==408
estimates store mongolia
regress trust val soctrust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4 & country==409
estimates store indonesia

set scheme tufte
coefplot japan, keep(val soctrust spe2 as1 dpe2) xline(0, lcolor(black)) levels(95) bylabel(Japan) ///
|| taiwan, keep(val soctrust spe2 as1 dpe2) xline(0, lcolor(black)) levels(95) bylabel(Taiwan) ///
|| korea, keep(val soctrust spe2 as1 dpe2) xline(0, lcolor(black)) levels(95) bylabel(South Korea) ///
|| mongolia, keep(val soctrust spe2 as1 dpe2) xline(0, lcolor(black)) levels(95) bylabel(Mongolia) ///
|| indonesia, keep(val soctrust spe2 as1 dpe2) xline(0, lcolor(black)) levels(95) bylabel(Indonesia) ///
coeflabels(val="liberal democratic values" soctrust="social trust" spe2="economic performance evaluations" as1="incumbent support" dpe2="democratic performance evaluations") ///
ylabel ( , labsize(small)) msymbol(S) nokey 
graph export oa_fig5.png, replace

regress trust val soctrust dpe2 polint status3 i.edulevel female age if wave==4
estimates store alllong
regress trust val soctrust dpe2 polint status3 i.edulevel female age if wave==4 & country==401
estimates store jplong
regress trust val soctrust dpe2 polint status3 i.edulevel female age if wave==4 & country==403
estimates store twlong
regress trust val soctrust dpe2 polint status3 i.edulevel female age if wave==4 & country==404
estimates store kolong
regress trust val soctrust dpe2 polint status3 i.edulevel female age if wave==4 & country==408
estimates store molong
regress trust val soctrust dpe2 polint status3 i.edulevel female age if wave==4 & country==409
estimates store idlong

regress trust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4
estimates store allshort
regress trust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4 & country==401
estimates store jpshort
regress trust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4 & country==403
estimates store twshort
regress trust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4 & country==404
estimates store koshort
regress trust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4 & country==408
estimates store moshort
regress trust spe2 as1 dpe2 polint status3 i.edulevel female age if wave==4 & country==409
estimates store idshort

estimates table alllong jplong twlong kolong molong idlong, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save robustness_dpe2_long, replace
estimates table allshort jpshort twshort koshort moshort idshort, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save robustness_dpe2_short, replace


* trust in each institution separately
estimates clear
regress trust3 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==401
estimates store japan
regress trust3 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==403
estimates store taiwan
regress trust3 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==404
estimates store korea
regress trust3 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==408
estimates store mongolia
regress trust3 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==409
estimates store indonesia

set scheme tufte
coefplot japan, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Japan) ///
|| taiwan, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Taiwan) ///
|| korea, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(South Korea) ///
|| mongolia, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Mongolia) ///
|| indonesia, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Indonesia) ///
coeflabels(val="liberal democratic values" soctrust="social trust" spe2="economic performance evaluations" as1="incumbent support") ///
ylabel ( , labsize(small)) msymbol(S) nokey 
graph export oa_fig2.png, replace

regress trust3 val soctrust polint status3 i.edulevel female age if wave==4
estimates store alllong
regress trust3 val soctrust polint status3 i.edulevel female age if wave==4 & country==401
estimates store jplong
regress trust3 val soctrust polint status3 i.edulevel female age if wave==4 & country==403
estimates store twlong
regress trust3 val soctrust polint status3 i.edulevel female age if wave==4 & country==404
estimates store kolong
regress trust3 val soctrust polint status3 i.edulevel female age if wave==4 & country==408
estimates store molong
regress trust3 val soctrust polint status3 i.edulevel female age if wave==4 & country==409
estimates store idlong
regress trust3 spe2 as1 polint status3 i.edulevel female age if wave==4
estimates store allshort
regress trust3 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==401
estimates store jpshort
regress trust3 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==403
estimates store twshort
regress trust3 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==404
estimates store koshort
regress trust3 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==408
estimates store moshort
regress trust3 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==409
estimates store idshort

estimates table alllong jplong twlong kolong molong idlong, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save robustness_trust3_long, replace
estimates table allshort jpshort twshort koshort moshort idshort, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save robustness_trust3_short, replace


estimates clear
regress trust5 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==401
estimates store japan
regress trust5 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==403
estimates store taiwan
regress trust5 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==404
estimates store korea
regress trust5 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==408
estimates store mongolia
regress trust5 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==409
estimates store indonesia

set scheme tufte
coefplot japan, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Japan) ///
|| taiwan, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Taiwan) ///
|| korea, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(South Korea) ///
|| mongolia, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Mongolia) ///
|| indonesia, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Indonesia) ///
coeflabels(val="liberal democratic values" soctrust="social trust" spe2="economic performance evaluations" as1="incumbent support") ///
ylabel ( , labsize(small)) msymbol(S) nokey 
graph export oa_fig3.png, replace

regress trust5 val soctrust polint status3 i.edulevel female age if wave==4
estimates store alllong
regress trust5 val soctrust polint status3 i.edulevel female age if wave==4 & country==401
estimates store jplong
regress trust5 val soctrust polint status3 i.edulevel female age if wave==4 & country==403
estimates store twlong
regress trust5 val soctrust polint status3 i.edulevel female age if wave==4 & country==404
estimates store kolong
regress trust5 val soctrust polint status3 i.edulevel female age if wave==4 & country==408
estimates store molong
regress trust5 val soctrust polint status3 i.edulevel female age if wave==4 & country==409
estimates store idlong
regress trust5 spe2 as1 polint status3 i.edulevel female age if wave==4
estimates store allshort
regress trust5 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==401
estimates store jpshort
regress trust5 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==403
estimates store twshort
regress trust5 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==404
estimates store koshort
regress trust5 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==408
estimates store moshort
regress trust5 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==409
estimates store idshort

estimates table alllong jplong twlong kolong molong idlong, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save robustness_trust5_long, replace
estimates table allshort jpshort twshort koshort moshort idshort, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save robustness_trust5_short, replace


estimates clear
regress trust7 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==401
estimates store japan
regress trust7 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==403
estimates store taiwan
regress trust7 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==404
estimates store korea
regress trust7 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==408
estimates store mongolia
regress trust7 val soctrust spe2 as1 polint status3 i.edulevel female age if wave==4 & country==409
estimates store indonesia

set scheme tufte
coefplot japan, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Japan) ///
|| taiwan, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Taiwan) ///
|| korea, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(South Korea) ///
|| mongolia, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Mongolia) ///
|| indonesia, keep(val soctrust spe2 as1) xline(0, lcolor(black)) levels(95) bylabel(Indonesia) ///
coeflabels(val="liberal democratic values" soctrust="social trust" spe2="economic performance evaluations" as1="incumbent support") ///
ylabel ( , labsize(small)) msymbol(S) nokey 
graph export oa_fig4.png, replace

regress trust7 val soctrust polint status3 i.edulevel female age if wave==4
estimates store alllong
regress trust7 val soctrust polint status3 i.edulevel female age if wave==4 & country==401
estimates store jplong
regress trust7 val soctrust polint status3 i.edulevel female age if wave==4 & country==403
estimates store twlong
regress trust7 val soctrust polint status3 i.edulevel female age if wave==4 & country==404
estimates store kolong
regress trust7 val soctrust polint status3 i.edulevel female age if wave==4 & country==408
estimates store molong
regress trust7 val soctrust polint status3 i.edulevel female age if wave==4 & country==409
estimates store idlong
regress trust7 spe2 as1 polint status3 i.edulevel female age if wave==4
estimates store allshort
regress trust7 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==401
estimates store jpshort
regress trust7 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==403
estimates store twshort
regress trust7 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==404
estimates store koshort
regress trust7 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==408
estimates store moshort
regress trust7 spe2 as1 polint status3 i.edulevel female age if wave==4 & country==409
estimates store idshort

estimates table alllong jplong twlong kolong molong idlong, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save robustness_trust7_long, replace
estimates table allshort jpshort twshort koshort moshort idshort, b(%10.2f) stats(N r2 r2_a)
putdocx begin
putdocx table tbl1 = etable
putdocx save robustness_trust7_short, replace


